1. Field of the invention
The present invention relates to image processing techniques, and in particular, to methods and apparatuses for image stabilization.
2. Description of the prior art
Unavoidably, when a user takes motion pictures with a digital video recorder, the motion pictures may be blur due to unstable hands or tripods, which makes viewers uncomfortable. To solve this problem, some digital video recorders have the function of image stabilization.
A motion picture (also called a video stream) is composed of plural successive images. To compensate the shakes, an image stabilization mechanism must determine a motion vector (i.e. the degree of shakes) between an image and its previous image. Generally, image stabilization mechanisms divide an image into plural blocks and respectively calculate a local motion vector (LMV) for each of the blocks.
FIG. 1(A) and FIG. 1(B) show an example of two successive images. In this exemplary video stream, the image 10B shown in FIG. 1(B) follows the image 10A shown in FIG. 1(A). Assume there is a circular object in the scene taken by the photographer. Theoretically, if both the positions of the circular object and the photographer remain steady, the image of the circular object should appear at the same place in the images 10A and 10B.
As shown in FIG. 1(A) and FIG. 1(B), the image of the circular object appears respectively in the block 12A of the image 10A and the block 12B of the image 10B. By comparing FIG. 1(A) and FIG. 1(B), it can be seen that the image of the circular object appears at the different locations in the images 10A and 10B. Based on the positions of the circular image, an image stabilization mechanism can obtain the LMV of the block 12B compared with the block 12A. The LMV of each of the blocks can be calculated in a similar way.
Generally, image stabilization mechanisms generate a global motion vector (GMV) of the image 10B by gathering statistic of the LMVs of all the blocks in the image 10B. The GMV is one of the factors for an image stabilization mechanism to adjust the image 10B. Traditional image stabilization mechanisms adjust the image 10B according to the following equation:CMV10B(t)=AGMV10B(t)=D*AGMV10A(t−1)+GMV10B(t)   (Equation 1)
The parameters t and (t−1) in Equation 1 are used for indicating the sequential relationship of images. The image 10B is corresponding to a time, t; the image 10A is corresponding to a previous time step, (t−1). GMV10B(t) represents the GMV of the image 10B. AGMV10B(t) represents an accumulated global motion vector (AGMV) corresponding to the image 10B. AGMV10B(t) is the sum of GMV10B(t) and the AGMV corresponding to the image 10A (i.e. AGMV10A(t)). The parameter D in Equation 1 is a damping factor and generally in the range of 0.875˜0.995. CMV10B(t) is the final motion vector of the image 10B; a traditional image stabilization mechanism adjusts the image 10B according to CMV10B(t).
For example, if CMV10B(t) is “three pixels toward right”, to compensate this shift, an image stabilization mechanism should correspondingly adjust the center of the image 10B toward left with the distance equal to three pixels. With the damping factor (D), the CMV of the video stream will be gradually converged to zero if the digital video recorder is not continuously shaken. After being adjusted by the above mechanism, if the user does not move, the centers of the images in the video stream should be approximately the same.
FIG. 2(A)˜FIG. 2(C) respectively illustrate an exemplary AGMV generated under different conditions. The AGMV in FIG. 2(A) generally appears when the digital video recorder is unintentionally shaken, i.e. not moved by a user. In reality, the user himself/herself may walk or run around while taking motion pictures, which could cause the change of the AGMV. The AGMV in FIG. 2(B) generally appears when the digital video recorder is simultaneously shaken and moved by a user. The AGMV in FIG. 2(C) generally appears when the digital video recorder is moved but not shaken by a user.
The drawback of prior arts is that traditional image stabilization mechanisms (i.e. those adopt Equation 1) only provide compensations to the shakes shown in FIG. 2(A); the movement of photographers is not considered. Therefore, when a photographer moves the digital video recorder intentionally, the images in the video stream might not faithfully reflect the movement; unnatural interruptions and shifts may exist therein.